home *** CD-ROM | disk | FTP | other *** search
- # Contributed to the epic project by Steve Horan on April 21, 1999.
- #
- # Here's a few useful functions I thought others might find useful
-
- # Find the minimum/maximum number. $min(<list>) $max(<list>)
- alias max {@ function_return = pop($numsort($*))}
- alias min {@ function_return = shift($numsort($*))}
-
- # $commasep(one,two,three) returns "one two three"
- # $commamake(one two three) returns "one,two,three"
- # Useful in opnotice scripts + other aliases.
- alias commasep {@ function_return = split(, $*)}
- alias commamake {@ function_return = tr(/ /,/$*)}
-
- # Somewhat kludge function here. This function finds the parent domain
- # to given host, rather than using a assumed approach
- # e.g. Many would view www.syd.lucid.net.au as being from the domain
- # lucid.net.au - when it's parent domain is in fact syd.lucid.net.au
- # This function has it's uses, to some more than others.
- # requires hop's pipe function, as well as the "dig" program.
- # $digdomain(squishycow.syd.lucid.net.au) returns "syd.lucid.net.au"
- alias digdomain {
- if (isalpha($right(1 $*)))
- {@ function_return = pipe(dig SOA $* | perl -lane 'print \$1 if /^([^;].
- *?)\\.\\s+.*SOA/')}
- {@ function_return = [$*]}
- }
-
- load pipe
-
- # - Wuhphy '99
- # sjhoran@syd.lucid.net.au
-
-